var tyreDatas = [
    {"id":"1106749","brand":"韩泰","title":"195/60R14 K415","img_tip":"适配索纳塔/大众桑塔纳等车型","price":"259"},
    {"id":"1106745","brand":"韩泰","title":"195/65R15 H426","img_tip":"适配伊兰特/悦动/福瑞迪等车型","price":"349"},
    {"id":"1106748","brand":"韩泰","title":"185/65R15 H426","img_tip":"适配伊兰特/悦动等车型","price":"349"},
    {"id":"1106744","brand":"韩泰","title":"195/55R15 K407","img_tip":"适配POLO原配/福美来/普力马等车型","price":"359"},
    {"id":"1106747","brand":"韩泰","title":"215/65R16 K415","img_tip":"适配途胜/逍客/途观等车型","price":"429"},
    {"id":"1106750","brand":"韩泰","title":"215/55R17 H426","img_tip":"适配起亚k5/第八代索纳塔等车型","price":"639"},
    {"id":"1106763","brand":"固特异","title":"225/55R16 EFF","img_tip":"适配奥迪A4/A6等车型","price":"619"},
    {"id":"1106760","brand":"固特异","title":"225/55R17 Assurance","img_tip":"适配迈锐宝/君威/君越等车型","price":"659"},
    {"id":"1106762","brand":"固特异","title":"225/50R17 NCT5","img_tip":"适配奥迪A4 A6/宝马5系等车型","price":"659"}
    
    ]

// 2.实例Vue对象
new Vue({
    el: '.g-box',
    data: {
        tyreData: tyreDatas
    },
    methods: {
        // APP端接口
        getApp:function(key,value){
            var appData = {"key":key,"value":value};
            // alert("key值是:"+key+",vlaue值是:"+value);
            //判断访问终端
                var browser={
                    versions:function(){
                        var u = navigator.userAgent, app = navigator.appVersion;
                        return {
                            trident: u.indexOf('Trident') > -1, //IE内核
                            presto: u.indexOf('Presto') > -1, //opera内核
                            webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                            gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
                            mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                            ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                            android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
                            iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
                            iPad: u.indexOf('iPad') > -1, //是否iPad
                            webApp: u.indexOf('Safari') == -1, //是否web应该程序，没有头部与底部
                            weixin: u.indexOf('MicroMessenger') > -1, //是否微信 （2015-01-22新增）
                            qq: u.match(/\sQQ/i) == " qq" //是否QQ
                        };
                    }(),
                    language:(navigator.browserLanguage || navigator.language).toLowerCase()
                }

            // 判断是安卓还是苹果
            if(browser.versions.android){
                getAppData(JSON.stringify(appData));
            }else{
                var iver = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
                iver = parseInt(iver[1],10);
                // IOS 8以上用webkit方法,IOS 8以下用UIWebview方法
                if(iver >= 8){
                    // AppModel是OC所注入的对象
                    window.webkit.messageHandlers.AppModel.postMessage({body:appData});
                }else{
                    getAppData(appData);
                }
            }
        }
    }
})